\(\int \frac {\tan (x)}{\cot (x)+\csc (x)} \, dx\) [205]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 7 \[ \int \frac {\tan (x)}{\cot (x)+\csc (x)} \, dx=-x+\text {arctanh}(\sin (x)) \]

[Out]

-x+arctanh(sin(x))

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.400, Rules used = {4477, 2918, 3855, 8} \[ \int \frac {\tan (x)}{\cot (x)+\csc (x)} \, dx=\text {arctanh}(\sin (x))-x \]

[In]

Int[Tan[x]/(Cot[x] + Csc[x]),x]

[Out]

-x + ArcTanh[Sin[x]]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2918

Int[((cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.))/((a_) + (b_.)*sin[(e_.) + (f_
.)*(x_)]), x_Symbol] :> Dist[g^2/a, Int[(g*Cos[e + f*x])^(p - 2)*(d*Sin[e + f*x])^n, x], x] - Dist[g^2/(b*d),
Int[(g*Cos[e + f*x])^(p - 2)*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x] && EqQ[a^2
 - b^2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4477

Int[(cot[(c_.) + (d_.)*(x_)]^(n_.)*(a_.) + csc[(c_.) + (d_.)*(x_)]^(n_.)*(b_.))^(p_)*(u_.), x_Symbol] :> Int[A
ctivateTrig[u]*Csc[c + d*x]^(n*p)*(b + a*Cos[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\sin (x) \tan (x)}{1+\cos (x)} \, dx \\ & = -\int 1 \, dx+\int \sec (x) \, dx \\ & = -x+\text {arctanh}(\sin (x)) \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(36\) vs. \(2(7)=14\).

Time = 0.06 (sec) , antiderivative size = 36, normalized size of antiderivative = 5.14 \[ \int \frac {\tan (x)}{\cot (x)+\csc (x)} \, dx=-x-\log \left (\cos \left (\frac {x}{2}\right )-\sin \left (\frac {x}{2}\right )\right )+\log \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right ) \]

[In]

Integrate[Tan[x]/(Cot[x] + Csc[x]),x]

[Out]

-x - Log[Cos[x/2] - Sin[x/2]] + Log[Cos[x/2] + Sin[x/2]]

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(24\) vs. \(2(7)=14\).

Time = 0.32 (sec) , antiderivative size = 25, normalized size of antiderivative = 3.57

method result size
default \(\ln \left (\tan \left (\frac {x}{2}\right )+1\right )-\ln \left (\tan \left (\frac {x}{2}\right )-1\right )-2 \arctan \left (\tan \left (\frac {x}{2}\right )\right )\) \(25\)
risch \(-x -\ln \left ({\mathrm e}^{i x}-i\right )+\ln \left (i+{\mathrm e}^{i x}\right )\) \(25\)

[In]

int(tan(x)/(cot(x)+csc(x)),x,method=_RETURNVERBOSE)

[Out]

ln(tan(1/2*x)+1)-ln(tan(1/2*x)-1)-2*arctan(tan(1/2*x))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 20 vs. \(2 (7) = 14\).

Time = 0.27 (sec) , antiderivative size = 20, normalized size of antiderivative = 2.86 \[ \int \frac {\tan (x)}{\cot (x)+\csc (x)} \, dx=-x + \frac {1}{2} \, \log \left (\sin \left (x\right ) + 1\right ) - \frac {1}{2} \, \log \left (-\sin \left (x\right ) + 1\right ) \]

[In]

integrate(tan(x)/(cot(x)+csc(x)),x, algorithm="fricas")

[Out]

-x + 1/2*log(sin(x) + 1) - 1/2*log(-sin(x) + 1)

Sympy [F]

\[ \int \frac {\tan (x)}{\cot (x)+\csc (x)} \, dx=\int \frac {\tan {\left (x \right )}}{\cot {\left (x \right )} + \csc {\left (x \right )}}\, dx \]

[In]

integrate(tan(x)/(cot(x)+csc(x)),x)

[Out]

Integral(tan(x)/(cot(x) + csc(x)), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 39 vs. \(2 (7) = 14\).

Time = 0.30 (sec) , antiderivative size = 39, normalized size of antiderivative = 5.57 \[ \int \frac {\tan (x)}{\cot (x)+\csc (x)} \, dx=-2 \, \arctan \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) + \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} + 1\right ) - \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} - 1\right ) \]

[In]

integrate(tan(x)/(cot(x)+csc(x)),x, algorithm="maxima")

[Out]

-2*arctan(sin(x)/(cos(x) + 1)) + log(sin(x)/(cos(x) + 1) + 1) - log(sin(x)/(cos(x) + 1) - 1)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 22 vs. \(2 (7) = 14\).

Time = 0.29 (sec) , antiderivative size = 22, normalized size of antiderivative = 3.14 \[ \int \frac {\tan (x)}{\cot (x)+\csc (x)} \, dx=-x + \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) + 1 \right |}\right ) - \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) - 1 \right |}\right ) \]

[In]

integrate(tan(x)/(cot(x)+csc(x)),x, algorithm="giac")

[Out]

-x + log(abs(tan(1/2*x) + 1)) - log(abs(tan(1/2*x) - 1))

Mupad [B] (verification not implemented)

Time = 23.40 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.57 \[ \int \frac {\tan (x)}{\cot (x)+\csc (x)} \, dx=2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {x}{2}\right )\right )-x \]

[In]

int(tan(x)/(cot(x) + 1/sin(x)),x)

[Out]

2*atanh(tan(x/2)) - x